<?
				ob_start();

session_start();
$userArray=$_SESSION['userArray'];
include ("usersystem/config/conf.php");
include ("usersystem/lib/mysqlClass.php");
include ("function/function.php");
include ("function/global.php");
include ("getCity.php");
$mysqlClass=new mysqlClass();

	function getAdsList($id,$limit=10)
	{
		global $mysqlClass;
		global $mediaTable;
		global $showCity;
		
		$where=" and (mtLost=0 or (mtLost=1 and (TO_DAYS(mtEdate) -TO_DAYS(NOW()))>=0)) ";
		if($showCity>0)
		{
			$where.=" and mtCity=$showCity";
		}
		$sql="select * from $mediaTable where  mtBig=$id and mtCheck=1 $where order by mtEdate desc limit 0, $limit";
		//echo $sql;
		$result=$mysqlClass->getRs($sql);
		$arrayx=array();
		while($array=$result->fetch_array())
		 {
			$arrayx[]=$array;
		 }
		return $arrayx;
	}
	/**
 * 将文本格式成适合js输出的字符串
 * @param string $string 需要处理的字符串
 * @param intval $isjs 是否执行字符串格式化，默认为执行
 * @return string 处理后的字符串
 */
function format_js($string, $isjs = 1) {
	$string = addslashes(str_replace(array("\r", "\n", "\t"), array('', '', ''), $string));
	return $isjs ? 'document.write("'.$string.'");' : $string;
}
function array_iconv($data, $input = 'gbk', $output = 'utf-8') {
	if (!is_array($data)) {
		return iconv($input, $output, $data);
	} else {
		foreach ($data as $key=>$val) {
			if(is_array($val)) {
				$data[$key] = array_iconv($val, $input, $output);
			} else {
				$data[$key] = iconv($input, $output, $val);
			}
		}
		return $data;
	}
}
?>
	 <?
	 	$array1=getAdsList(1,8);
	 	for($i=1;$i<=count($array1);$i++)
		{
			  if($urlrewrite)
				$url="mediadetail-".$array1[$i-1]['mtId'].".html";
			  else
				$url="mediadetail.php?mtId=".$array1[$i-1]['mtId'];
			  if ($array1[$i-1]['mtSid']==5 || $array1[$i-1]['mtSid']==116)
				$url="bustail-".$array1[$i-1]['mtId'].".html";
				/*
				if($array['mtBig']==$mediaType['户外广告']['编号'])
					$url="r_outdooraddtl-$array[mtId].html";
				else
					$url="r_indooraddtl-$array[mtId].html";
				*/
			  $picUrl=$array1[$i-1]['mtPics'];
			  if($picUrl=="")
				$picUrl="images/default.gif"; 
			  $mtName=getLenStr2($array1[$i-1]['mtName'],8);
			  $mtName=array_iconv($mtName);
			  if($array1[$i-1]["mtPrice"]!="")
			  {
			  $mtPrice=eregi_replace("[^0-9.]+","",$array1[$i-1]["mtPrice"]);
			  $mtPrice=eregi_replace("[0-9.]+","<span style=color:#f60;>￥".$mtPrice."</span>",$array1[$i-1]["mtPrice"]); 
			  }
			  else
			  {
			  $mtPrice="面谈";
			  }
			  $weizhi=getLenStr2($array1[$i-1]['mtAdd'],8);
			  $xiangxi=getLenStr2(trim($array1[$i-1]['mtContent']),9);
			$xiangxi = substr($xiangxi,4);
			$cityid=$array1[$i-1]['mtCity'];
			$mtCon=$array1[$i-1]['mtCon'];
			
	 ?>
	   <div class=adtitle><a href=http://www.ggpzz.com/<?=$url?> target=_blank><img src=<?=$picUrl?> width=97 height=70 border=0 /></a><br />
	   <a href=<?=$url?> target=_blank><?=$mtName?></a></div>
<?
	}
?>
<?
				$html = ob_get_contents();
				ob_clean();
				echo format_js($html);
?>